from socket import *

ip_port=("localhost",1234)
client_socket=socket(AF_INET,SOCK_STREAM)
client_socket.connect_ex(ip_port)

while True:
    msg=input(">>>").strip()
    if not msg:continue
    client_socket.sendall(msg.encode("utf-8"))
    print(msg.encode("utf-8"))
    data = client_socket.recv(1024)
    print(data.decode("utf-8"))